package rmaqlc31.basic;

import java.util.Scanner;

public class J10_Ex72_OOP {

	public static void main(String[] args) {
		// 객체 생성 및 객체 다루기
		
		Scanner sc = new Scanner(System.in);

		Ex72_Retangle r = new Ex72_Retangle();
		Ex73_Fan fan = new Ex73_Fan();
		Ex74_Account acc = new Ex74_Account();
		Ex75_Stock sto = new Ex75_Stock();
		
		/*System.out.print("가로값을 입력하세요 : ");
		r.width = sc.nextDouble();
		System.out.print("세로값을 입력하세요  : ");
		r.height = sc.nextDouble();
		System.out.print("색깔을 입력하세요 : ");
		r.color = sc.next();
		
		System.out.println();
		System.out.println("width : "+r.width);
		System.out.println("height : "+r.height);
		System.out.println("color : "+r.color);
		System.out.println("area : "+r.getArea());
		System.out.println("circum : "+r.getCircum());*/
		
		r = new Ex72_Retangle(4, 40, "red");
		
		System.out.println(r.getArea());
		System.out.println(r.getCircum());
		
		System.out.println();
		//---------------------------------------------------------
		System.out.print("팬 크기를 입력하세요 : ");
		fan.radius = sc.nextInt();
		System.out.print("선풍기 색상을 입력하세요 : ");
		fan.color = sc.next();
		System.out.print("회전속도를 입력하세요 : ");
		fan.speed = sc.nextInt();
		System.out.print("동작상태를 입력하세요 : ");
		fan.on = sc.nextBoolean();
		
		System.out.println();
		System.out.println("팬 크기 : "+fan.radius);
		System.out.println("선풍기 색상 : "+fan.color);
		if(fan.speed==fan.SLOW){
			System.out.println("속도 : 최저속도");
		}else if(fan.speed==fan.MEDIUM){
			System.out.println("속도 : 중간속도");
		}else
			System.out.println("속도 : 최고속도");
		if(fan.on==false){
			System.out.println("동작상태 : 정지");
		}else
			System.out.println("동작상태 : 동작중");
		
		System.out.println();
		//-------------------------------------------------------
		System.out.print("계좌번호를 입력하세요 : ");
		acc.aid = sc.nextInt();
		System.out.print("통장잔액을 입력하세요 : ");
		acc.balance = sc.nextDouble();
		System.out.print("연이율을 입력하세요 : ");
		acc.interestRate = sc.nextDouble();
		System.out.print("통장개설 날짜를 입력하세요 : ");
		acc.dateCreated = sc.next();
		
		System.out.println();
		System.out.println("계좌번호 : "+acc.aid);
		System.out.println("통장잔액 : "+acc.balance);
		System.out.println("연이율 : "+acc.interestRate);
		System.out.println("통장개설 날짜 : "+acc.dateCreated);
		
		System.out.println();
		//-------------------------------------------------------
		System.out.print("회사명을 입력하세요 : ");
		sto.sname = sc.next();
		System.out.print("어제의 종가를 입력하세요 : ");
		sto.previousClosingPrice = sc.nextInt();
		System.out.print("현재가를 입력하세요 : ");
		sto.currentPrice = sc.nextInt();
		
		System.out.println();
		System.out.println("회사명 : "+sto.sname);
		System.out.println("종가 : "+sto.previousClosingPrice);
		System.out.println("현재가  : "+sto.currentPrice);
	
		sc.close();
	} // main

} // class

class Ex72_Retangle {
	double width;
	double height;
	String color;
	
	public Ex72_Retangle() {
		// 생성자 : 객체 생성 및 멤버변수 초기화
		width = 1.0;
		height = 1.0;
		color = "White";
	}
	public Ex72_Retangle(double width, double height, String color) {
		this.width = width;
		this.height = height;
		this.color = color;
	}
	double getArea() {
		double area = width*height;
		return area;
	}
	double getCircum() {
		double circum = (width+height)*2;
		return circum;
	}
}

class Ex73_Fan {
	final int SLOW = 1;
	final int MEDIUM = 2;
	final int FAST = 3;
	int speed;
	boolean on;
	double radius;
	String color;
	
	public Ex73_Fan() {
		speed = SLOW;
		on = false;
		radius = 5.0;
		color = "blue";
	}
}

class Ex74_Account {
	int aid;
	double balance;
	double interestRate;
	String dateCreated;
	public Ex74_Account() {
		aid = 0;
		balance = 0;
		interestRate = 0;
	}
}

class Ex75_Stock {
	String sname;
	int previousClosingPrice;
	int currentPrice;
	public Ex75_Stock() {
		
	}
}
